<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	/*
 *      Manager.php
 *      
 *      Copyright 2011 godfather.typhoon.tycoon@banme <chungnguyenhuu911@gmail.com>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 *      
 *      
 */
	class  Manager   extends  CI_Controller{
		
		function  Manager  (){
			//parent::CI_Controller();
			
		}
		/* ---------------------------------------------------
		 * Overriding base construct
		 * ---------------------------------------------------
		 * Object : 
		 * 		+ Load default setting to this controller.
		 * Parameters : void
		 * Return : void
		 * Access : privated		
		 * 
		 * */ 
		function __construct(){
			parent::__construct();
			// Load default (messages/resouces 's title) to pages
			// NOTE : must be placed in here
			$this->lang->load('messages','vietnamese');
			$this->lang->load('form_validation','vietnamese');
			//$this->load->library('form_validation');
			//$this->load->helper(array('form', 'url'));
		}
		/* ---------------------------------------------------
		 * Index functions
		 * ---------------------------------------------------
		 * Object : 
		 * 		+ Control actions on index pages.
		 * Parameters : void
		 * Return : void
		 * Access : public		
		 *  
		 * */ 
		 function index(){
			
			/* ---------------------------------------------------
			 * Check admin login
			 *  
			*/ 
			if(!$this->session->userdata($this->config->item('admin_session_name'))){
				redirect('admin/login', 'refesh');
				return;
			}else{
				redirect('product', 'refesh');
				return;
			}
		}
		
		/* ---------------------------------------------------
		 * View functions
		 * ---------------------------------------------------
		 * Object : 
		 * 		+ Control select page view .
		 * Parameters : 
		 * 		+ pages : nums to select page view
		 * Return : 
		 * 		+ html fragments
		 * Access : public		
		 *  
		 * */ 
		 function view($page=NULL)
		 {
			 
			 switch($page)
			 {
				 case 1: // login
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/login';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);					
					break;
				 case 2: // edit profile
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/editprofile';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);		
					break;
				 case 3: // manager website
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/module';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				 case 4: // manager product
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/product';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				 case 5: // manager products picture
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/mainslide';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				 case 6 : // manager sub silde 
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/subslide';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				case 7 : // manager counter
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/subslide';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				/*
				*sub case
				*/
				case 8 : // manager edit product
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/editproduct';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				case 9 : // manager edit picture
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/editpicture';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				case 10 : // manager edit video
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/editpicture';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				case 11 : // manager edit module
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/editpicture';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				case 11 : // manager edit counter
					// Get page content 's index 
					//init data
					$data['main_content'] = 'manager/editcounter';
					// Load template 's guest and passed url 's index guest page to load content
					$this->load->view('templates/manager/template', $data);	
					break;
				 default : // default is index page
					  $this->load->view('manager/editprofile');
					  break;
			 }
		 }
	}
?>